`include "para_def.v"
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company: 
// Engineer: 
// 
// Create Date:    14:56:05 07/09/2013 
// Design Name: 
// Module Name:    stage3 
// Project Name: 
// Target Devices: 
// Tool versions: 
// Description: 
//
// Dependencies: 
//
// Revision: 
// Revision 0.01 - File Created
// Additional Comments: 
//
//////////////////////////////////////////////////////////////////////////////////
module stage3(	 clk
					,rst_n
					
					,valid_2_3
					,sel_2_3
					,field_counter_2_3
					,data_2_3
					,msg_end_2_3
					
					,msg_end_3_4
					,ID_0
					,ID_1
					,ID_2
					,ID_3
					,ID_4
					,ID_5
					,ID_6
					,ID_7
					,ID_8
					,ID_9
					,ID_10
					,ID_11
					,ID_12
					,ID_13
					,ID_14
					,ID_15
					,ID_16
					,ID_17
					,ID_18
					,ID_19
					,ID_20
					,ID_21
					,ID_22
					,ID_23
					,ID_24
					,ID_25
					,ID_26
					,ID_27
					,ID_28
					,ID_29
					,ID_30
					,ID_31
					,ID_32
					,ID_33
					,ID_34
					,ID_35
					,ID_36
					,ID_37
					,ID_38
					,ID_39
					,ID_40
					,ID_41
					,ID_42
					,ID_43
					,ID_44
					,ID_45
					,ID_46
					,ID_47
					,ID_48
					,ID_49
    );
	 
input clk;
input rst_n;
input valid_2_3;
input [49:0]	sel_2_3;
input [3:0]		field_counter_2_3;
input [7:0]		data_2_3;
input msg_end_2_3;

output msg_end_3_4;
output [`ID_0_LEN*8 - 1  : 0]			ID_0;
output [`ID_1_LEN*8 - 1  : 0]			ID_1;
output [`ID_2_LEN*8 - 1  : 0]			ID_2;
output [`ID_3_LEN*8 - 1  : 0]			ID_3;
output [`ID_4_LEN*8 - 1  : 0]			ID_4;
output [`ID_5_LEN*8 - 1  : 0]			ID_5;
output [`ID_6_LEN*8 - 1  : 0]			ID_6;
output [`ID_7_LEN*8 - 1  : 0]			ID_7;
output [`ID_8_LEN*8 - 1  : 0]	 		ID_8;
output [`ID_9_LEN*8 - 1  : 0]			ID_9;
output [`ID_10_LEN*8 - 1  : 0]			ID_10;
output [`ID_11_LEN*8 - 1  : 0]			ID_11;
output [`ID_12_LEN*8 - 1  : 0]			ID_12;
output [`ID_13_LEN*8 - 1  : 0]			ID_13;
output [`ID_14_LEN*8 - 1  : 0]			ID_14;
output [`ID_15_LEN*8 - 1  : 0]			ID_15;
output [`ID_16_LEN*8 - 1  : 0]			ID_16;
output [`ID_17_LEN*8 - 1  : 0]			ID_17;
output [`ID_18_LEN*8 - 1  : 0]	 		ID_18;
output [`ID_19_LEN*8 - 1  : 0]			ID_19;
output [`ID_20_LEN*8 - 1  : 0]			ID_20;
output [`ID_21_LEN*8 - 1  : 0]			ID_21;
output [`ID_22_LEN*8 - 1  : 0]			ID_22;
output [`ID_23_LEN*8 - 1  : 0]			ID_23;
output [`ID_24_LEN*8 - 1  : 0]			ID_24;
output [`ID_25_LEN*8 - 1  : 0]			ID_25;
output [`ID_26_LEN*8 - 1  : 0]			ID_26;
output [`ID_27_LEN*8 - 1  : 0]			ID_27;
output [`ID_28_LEN*8 - 1  : 0]	 		ID_28;
output [`ID_29_LEN*8 - 1  : 0]			ID_29;
output [`ID_30_LEN*8 - 1  : 0]			ID_30;
output [`ID_31_LEN*8 - 1  : 0]			ID_31;
output [`ID_32_LEN*8 - 1  : 0]			ID_32;
output [`ID_33_LEN*8 - 1  : 0]			ID_33;
output [`ID_34_LEN*8 - 1  : 0]			ID_34;
output [`ID_35_LEN*8 - 1  : 0]			ID_35;
output [`ID_36_LEN*8 - 1  : 0]			ID_36;
output [`ID_37_LEN*8 - 1  : 0]			ID_37;
output [`ID_38_LEN*8 - 1  : 0]	 		ID_38;
output [`ID_39_LEN*8 - 1  : 0]			ID_39;
output [`ID_40_LEN*8 - 1  : 0]			ID_40;
output [`ID_41_LEN*8 - 1  : 0]			ID_41;
output [`ID_42_LEN*8 - 1  : 0]			ID_42;
output [`ID_43_LEN*8 - 1  : 0]			ID_43;
output [`ID_44_LEN*8 - 1  : 0]			ID_44;
output [`ID_45_LEN*8 - 1  : 0]			ID_45;
output [`ID_46_LEN*8 - 1  : 0]			ID_46;
output [`ID_47_LEN*8 - 1  : 0]			ID_47;
output [`ID_48_LEN*8 - 1  : 0]	 		ID_48;
output [`ID_49_LEN*8 - 1  : 0]			ID_49;

integer i;

reg msg_end_3_4;
reg [7 : 0]				ID_0_reg [`ID_0_LEN + 1  : 0];
reg [7 : 0]				ID_1_reg [`ID_1_LEN + 1  : 0];
reg [7 : 0]				ID_2_reg [`ID_2_LEN + 1  : 0];
reg [7 : 0]				ID_3_reg [`ID_3_LEN + 1  : 0];
reg [7 : 0]				ID_4_reg [`ID_4_LEN + 1  : 0];
reg [7 : 0]				ID_5_reg [`ID_5_LEN + 1  : 0];
reg [7 : 0]				ID_6_reg [`ID_6_LEN + 1  : 0];
reg [7 : 0]				ID_7_reg [`ID_7_LEN + 1  : 0];
reg [7 : 0]				ID_8_reg [`ID_8_LEN + 1  : 0];
reg [7 : 0]				ID_9_reg [`ID_9_LEN + 1  : 0];
reg [7 : 0]				ID_10_reg [`ID_10_LEN + 1  : 0];
reg [7 : 0]				ID_11_reg [`ID_11_LEN + 1  : 0];
reg [7 : 0]				ID_12_reg [`ID_12_LEN + 1  : 0];
reg [7 : 0]				ID_13_reg [`ID_13_LEN + 1  : 0];
reg [7 : 0]				ID_14_reg [`ID_14_LEN + 1  : 0];
reg [7 : 0]				ID_15_reg [`ID_15_LEN + 1  : 0];
reg [7 : 0]				ID_16_reg [`ID_16_LEN + 1  : 0];
reg [7 : 0]				ID_17_reg [`ID_17_LEN + 1  : 0];
reg [7 : 0]				ID_18_reg [`ID_18_LEN + 1  : 0];
reg [7 : 0]				ID_19_reg [`ID_19_LEN + 1  : 0];
reg [7 : 0]				ID_20_reg [`ID_20_LEN + 1  : 0];
reg [7 : 0]				ID_21_reg [`ID_21_LEN + 1  : 0];
reg [7 : 0]				ID_22_reg [`ID_22_LEN + 1  : 0];
reg [7 : 0]				ID_23_reg [`ID_23_LEN + 1  : 0];
reg [7 : 0]				ID_24_reg [`ID_24_LEN + 1  : 0];
reg [7 : 0]				ID_25_reg [`ID_25_LEN + 1  : 0];
reg [7 : 0]				ID_26_reg [`ID_26_LEN + 1  : 0];
reg [7 : 0]				ID_27_reg [`ID_27_LEN + 1  : 0];
reg [7 : 0]				ID_28_reg [`ID_28_LEN + 1  : 0];
reg [7 : 0]				ID_29_reg [`ID_29_LEN + 1  : 0];
reg [7 : 0]				ID_30_reg [`ID_30_LEN + 1  : 0];
reg [7 : 0]				ID_31_reg [`ID_31_LEN + 1  : 0];
reg [7 : 0]				ID_32_reg [`ID_32_LEN + 1  : 0];
reg [7 : 0]				ID_33_reg [`ID_33_LEN + 1  : 0];
reg [7 : 0]				ID_34_reg [`ID_34_LEN + 1  : 0];
reg [7 : 0]				ID_35_reg [`ID_35_LEN + 1  : 0];
reg [7 : 0]				ID_36_reg [`ID_36_LEN + 1  : 0];
reg [7 : 0]				ID_37_reg [`ID_37_LEN + 1  : 0];
reg [7 : 0]				ID_38_reg [`ID_38_LEN + 1  : 0];
reg [7 : 0]				ID_39_reg [`ID_39_LEN + 1  : 0];
reg [7 : 0]				ID_40_reg [`ID_40_LEN + 1  : 0];
reg [7 : 0]				ID_41_reg [`ID_41_LEN + 1  : 0];
reg [7 : 0]				ID_42_reg [`ID_42_LEN + 1  : 0];
reg [7 : 0]				ID_43_reg [`ID_43_LEN + 1  : 0];
reg [7 : 0]				ID_44_reg [`ID_44_LEN + 1  : 0];
reg [7 : 0]				ID_45_reg [`ID_45_LEN + 1  : 0];
reg [7 : 0]				ID_46_reg [`ID_46_LEN + 1  : 0];
reg [7 : 0]				ID_47_reg [`ID_47_LEN + 1  : 0];
reg [7 : 0]				ID_48_reg [`ID_48_LEN + 1  : 0];
reg [7 : 0]				ID_49_reg [`ID_49_LEN + 1  : 0];

always@(posedge clk or negedge rst_n)
begin
	if (~rst_n)
		msg_end_3_4<=0;
	else
		msg_end_3_4<=msg_end_2_3;
end

always@(posedge clk or negedge rst_n)
begin
	if (~rst_n) begin
		for (i=0;i<`ID_0_LEN + 2;i=i+1)
			ID_0_reg[i]		<= 0;
		for (i=0;i<`ID_1_LEN + 2;i=i+1)
			ID_1_reg[i]		<= 0;
		for (i=0;i<`ID_2_LEN + 2;i=i+1)
			ID_2_reg[i]		<= 0;
		for (i=0;i<`ID_3_LEN + 2;i=i+1)
			ID_3_reg[i]		<= 0;
		for (i=0;i<`ID_4_LEN + 2;i=i+1)
			ID_4_reg[i]		<= 0;
		for (i=0;i<`ID_5_LEN + 2;i=i+1)
			ID_5_reg[i] 	<= 0;
		for (i=0;i<`ID_6_LEN + 2;i=i+1)
			ID_6_reg[i] 	<= 0;
		for (i=0;i<`ID_7_LEN + 2;i=i+1)
			ID_7_reg[i] 	<= 0;
		for (i=0;i<`ID_8_LEN + 2;i=i+1)
			ID_8_reg[i] 	<= 0;
		for (i=0;i<`ID_9_LEN + 2;i=i+1)
			ID_9_reg[i] 	<= 0;
		for (i=0;i<`ID_10_LEN + 2;i=i+1)
			ID_10_reg[i]	<= 0;
		for (i=0;i<`ID_11_LEN + 2;i=i+1)
			ID_11_reg[i]	<= 0;
		for (i=0;i<`ID_12_LEN + 2;i=i+1)
			ID_12_reg[i]	<= 0;
		for (i=0;i<`ID_13_LEN + 2;i=i+1)
			ID_13_reg[i]	<= 0;
		for (i=0;i<`ID_14_LEN + 2;i=i+1)
			ID_14_reg[i]	<= 0;
		for (i=0;i<`ID_15_LEN + 2;i=i+1)
			ID_15_reg[i]	<= 0;
		for (i=0;i<`ID_16_LEN + 2;i=i+1)
			ID_16_reg[i]	<= 0;
		for (i=0;i<`ID_17_LEN + 2;i=i+1)
			ID_17_reg[i]	<= 0;
		for (i=0;i<`ID_18_LEN + 2;i=i+1)
			ID_18_reg[i]	<= 0;
		for (i=0;i<`ID_19_LEN + 2;i=i+1)
			ID_19_reg[i]	<= 0;
		for (i=0;i<`ID_20_LEN + 2;i=i+1)
			ID_20_reg[i]	<= 0;
		for (i=0;i<`ID_21_LEN + 2;i=i+1)
			ID_21_reg[i]	<= 0;
		for (i=0;i<`ID_22_LEN + 2;i=i+1)
			ID_22_reg[i]	<= 0;
		for (i=0;i<`ID_23_LEN + 2;i=i+1)
			ID_23_reg[i]	<= 0;
		for (i=0;i<`ID_24_LEN + 2;i=i+1)
			ID_24_reg[i]	<= 0;
		for (i=0;i<`ID_25_LEN + 2;i=i+1)
			ID_25_reg[i]	<= 0;
		for (i=0;i<`ID_26_LEN + 2;i=i+1)
			ID_26_reg[i]	<= 0;
		for (i=0;i<`ID_27_LEN + 2;i=i+1)
			ID_27_reg[i]	<= 0;
		for (i=0;i<`ID_28_LEN + 2;i=i+1)
			ID_28_reg[i]	<= 0;
		for (i=0;i<`ID_29_LEN + 2;i=i+1)
			ID_29_reg[i]	<= 0;
		for (i=0;i<`ID_30_LEN + 2;i=i+1)
			ID_30_reg[i]	<= 0;
		for (i=0;i<`ID_31_LEN + 2;i=i+1)
			ID_31_reg[i]	<= 0;
		for (i=0;i<`ID_32_LEN + 2;i=i+1)
			ID_32_reg[i]	<= 0;
		for (i=0;i<`ID_33_LEN + 2;i=i+1)
			ID_33_reg[i]	<= 0;
		for (i=0;i<`ID_34_LEN + 2;i=i+1)
			ID_34_reg[i]	<= 0;
		for (i=0;i<`ID_35_LEN + 2;i=i+1)
			ID_35_reg[i]	<= 0;
		for (i=0;i<`ID_36_LEN + 2;i=i+1)
			ID_36_reg[i]	<= 0;
		for (i=0;i<`ID_37_LEN + 2;i=i+1)
			ID_37_reg[i]	<= 0;
		for (i=0;i<`ID_38_LEN + 2;i=i+1)
			ID_38_reg[i]	<= 0;
		for (i=0;i<`ID_39_LEN + 2;i=i+1)
			ID_39_reg[i]	<= 0;
		for (i=0;i<`ID_40_LEN + 2;i=i+1)
			ID_40_reg[i]	<= 0;
		for (i=0;i<`ID_41_LEN + 2;i=i+1)
			ID_41_reg[i]	<= 0;
		for (i=0;i<`ID_42_LEN + 2;i=i+1)
			ID_42_reg[i]	<= 0;
		for (i=0;i<`ID_43_LEN + 2;i=i+1)
			ID_43_reg[i]	<= 0;
		for (i=0;i<`ID_44_LEN + 2;i=i+1)
			ID_44_reg[i]	<= 0;
		for (i=0;i<`ID_45_LEN + 2;i=i+1)
			ID_45_reg[i]	<= 0;
		for (i=0;i<`ID_46_LEN + 2;i=i+1)
			ID_46_reg[i]	<= 0;
		for (i=0;i<`ID_47_LEN + 2;i=i+1)
			ID_47_reg[i]	<= 0;
		for (i=0;i<`ID_48_LEN + 2;i=i+1)
			ID_48_reg[i]	<= 0;
		for (i=0;i<`ID_49_LEN + 2;i=i+1)
			ID_49_reg[i]	<= 0;
	end
	else begin
		if (valid_2_3) begin
		case ( sel_2_3 )
			50'b00000000000000000000000000000000000000000000000001 :
				ID_0_reg[0]	<=	data_2_3;
			50'b00000000000000000000000000000000000000000000000010 :
				ID_1_reg[0]	<=	data_2_3;
			50'b00000000000000000000000000000000000000000000000100 :
				ID_2_reg[0]	<=	data_2_3;
			50'b00000000000000000000000000000000000000000000001000 :
				ID_3_reg[0]	<=	data_2_3;
			50'b00000000000000000000000000000000000000000000010000 : begin
				if (field_counter_2_3==0) begin
				for (i=0;i<`ID_4_LEN;i=i+1)		ID_4_reg[i] <= 0;
				ID_4_reg[`ID_4_LEN]	<=	data_2_3;
				end
				else begin
				for (i=0;i<`ID_4_LEN;i=i+1)		ID_4_reg[i] <= ID_4_reg[i+1];
				ID_4_reg[`ID_4_LEN]	<=	data_2_3;
				end
			end
			50'b00000000000000000000000000000000000000000000100000 : begin
				if (field_counter_2_3==0) begin
				for (i=0;i<`ID_5_LEN;i=i+1)		ID_5_reg[i] <= 0;
				ID_5_reg[`ID_5_LEN]	<=	data_2_3;
				end
				else begin
				for (i=0;i<`ID_5_LEN;i=i+1)		ID_5_reg[i] <= ID_5_reg[i+1];
				ID_5_reg[`ID_5_LEN]	<=	data_2_3;
				end
			end
			50'b00000000000000000000000000000000000000000001000000 : begin
				if (field_counter_2_3==0) begin
				for (i=0;i<`ID_6_LEN - 1;i=i+1)		ID_6_reg[i] <= 0;
				ID_6_reg[`ID_6_LEN-1]	<=	data_2_3;
				end
				else begin
				for (i=0;i<`ID_6_LEN - 1;i=i+1)		ID_6_reg[i] <= ID_6_reg[i+1];
				ID_6_reg[`ID_6_LEN-1]	<=	data_2_3;
				end
			end
			50'b00000000000000000000000000000000000000000010000000 :
				ID_7_reg[0]	<=	data_2_3;
			50'b00000000000000000000000000000000000000000100000000 : begin
				if (field_counter_2_3==0) begin
				ID_8_reg[0] <= 0;
				ID_8_reg[1] <= 0;
				ID_8_reg[2]	<=	data_2_3;
				end
				else begin
				ID_8_reg[0] <= ID_8_reg[1];
				ID_8_reg[1] <= ID_8_reg[2];
				ID_8_reg[2]	<=	data_2_3;
				end
			end
			50'b00000000000000000000000000000000000000001000000000 : begin
				if (field_counter_2_3==0) begin
				ID_9_reg[0] <= 0;
				ID_9_reg[1] <= 0;
				ID_9_reg[2]	<=	data_2_3;
				end
				else begin
				ID_9_reg[0] <= ID_9_reg[1];
				ID_9_reg[1] <= ID_9_reg[2];
				ID_9_reg[2]	<=	data_2_3;
				end
			end
			50'b00000000000000000000000000000000000000010000000000 :
				ID_10_reg[0]	<=	data_2_3;
			50'b00000000000000000000000000000000000000100000000000 : begin
				if (field_counter_2_3==0) begin
				for (i=0;i<`ID_11_LEN;i=i+1)		ID_11_reg[i] <= 0;
				ID_11_reg[`ID_11_LEN]	<=	data_2_3;
				end
				else begin
				for (i=0;i<`ID_11_LEN;i=i+1)		ID_11_reg[i] <= ID_11_reg[i+1];
				ID_11_reg[`ID_11_LEN]	<=	data_2_3;
				end
			end
			50'b00000000000000000000000000000000000001000000000000 :
				ID_12_reg[0]	<=	data_2_3;
			50'b00000000000000000000000000000000000010000000000000 : begin
				if (field_counter_2_3==0) begin
				for (i=0;i<`ID_13_LEN;i=i+1)		ID_13_reg[i] <= 0;
				ID_13_reg[`ID_13_LEN]	<=	data_2_3;
				end
				else begin
				for (i=0;i<`ID_13_LEN;i=i+1)		ID_13_reg[i] <= ID_13_reg[i+1];
				ID_13_reg[`ID_13_LEN]	<=	data_2_3;
				end
			end
			50'b00000000000000000000000000000000000100000000000000 : begin
				if (field_counter_2_3==0) begin
				for (i=0;i<`ID_14_LEN;i=i+1)		ID_14_reg[i] <= 0;
				ID_14_reg[`ID_14_LEN]	<=	data_2_3;
				end
				else begin
				for (i=0;i<`ID_14_LEN;i=i+1)		ID_14_reg[i] <= ID_14_reg[i+1];
				ID_14_reg[`ID_14_LEN]	<=	data_2_3;
				end
			end
			50'b00000000000000000000000000000000001000000000000000 :
				ID_15_reg[0]				<=	data_2_3;
			50'b00000000000000000000000000000000010000000000000000 : begin
				if (field_counter_2_3==0) begin
				for (i=0;i<`ID_16_LEN+1;i=i+1)		ID_16_reg[i] <= 0;
				ID_16_reg[`ID_16_LEN+1]	<=	data_2_3;
				end
				else begin
				for (i=0;i<`ID_16_LEN+1;i=i+1)		ID_16_reg[i] <= ID_16_reg[i+1];
				ID_16_reg[`ID_16_LEN+1]	<=	data_2_3;
				end
			end
			50'b00000000000000000000000000000000100000000000000000 : begin
				if (field_counter_2_3==0) begin
				for (i=0;i<`ID_17_LEN+1;i=i+1)		ID_17_reg[i] <= 0;
				ID_17_reg[`ID_17_LEN+1]	<=	data_2_3;
				end
				else begin
				for (i=0;i<`ID_17_LEN+1;i=i+1)		ID_17_reg[i] <= ID_17_reg[i+1];
				ID_17_reg[`ID_17_LEN+1]	<=	data_2_3;
				end
			end
			50'b00000000000000000000000000000001000000000000000000 : begin
				if (field_counter_2_3==0) begin
				for (i=0;i<`ID_18_LEN+1;i=i+1)		ID_18_reg[i] <= 0;
				ID_18_reg[`ID_18_LEN+1]	<=	data_2_3;
				end
				else begin
				for (i=0;i<`ID_18_LEN+1;i=i+1)		ID_18_reg[i] <= ID_18_reg[i+1];
				ID_18_reg[`ID_18_LEN+1]	<=	data_2_3;
				end
			end
			50'b00000000000000000000000000000010000000000000000000 : begin
				if (field_counter_2_3==0) begin
				for (i=0;i<`ID_19_LEN+1;i=i+1)		ID_19_reg[i] <= 0;
				ID_19_reg[`ID_19_LEN+1]	<=	data_2_3;
				end
				else begin
				for (i=0;i<`ID_19_LEN+1;i=i+1)		ID_19_reg[i] <= ID_19_reg[i+1];
				ID_19_reg[`ID_19_LEN+1]	<=	data_2_3;
				end
			end
			50'b00000000000000000000000000000100000000000000000000 : begin
				if (field_counter_2_3==0) begin
				for (i=0;i<`ID_20_LEN+1;i=i+1)		ID_20_reg[i] <= 0;
				ID_20_reg[`ID_20_LEN+1]	<=	data_2_3;
				end
				else begin
				for (i=0;i<`ID_20_LEN+1;i=i+1)		ID_20_reg[i] <= ID_20_reg[i+1];
				ID_20_reg[`ID_20_LEN+1]	<=	data_2_3;
				end
			end
			50'b00000000000000000000000000001000000000000000000000 :
				ID_21_reg[0]				<=	data_2_3;
			50'b00000000000000000000000000010000000000000000000000 : begin
				if (field_counter_2_3==0) begin
				for (i=0;i<`ID_22_LEN+1;i=i+1)		ID_22_reg[i] <= 0;
				ID_22_reg[`ID_22_LEN+1]	<=	data_2_3;
				end
				else begin
				for (i=0;i<`ID_22_LEN+1;i=i+1)		ID_22_reg[i] <= ID_22_reg[i+1];
				ID_22_reg[`ID_22_LEN+1]	<=	data_2_3;
				end
			end
			50'b00000000000000000000000000100000000000000000000000 :
				ID_23_reg[0]				<=	data_2_3;
			50'b00000000000000000000000001000000000000000000000000 :
				ID_24_reg[0]				<=	data_2_3;
			50'b00000000000000000000000010000000000000000000000000 : begin
				if (field_counter_2_3==0) begin
				for (i=0;i<`ID_25_LEN+1;i=i+1)		ID_25_reg[i] <= 0;
				ID_25_reg[`ID_25_LEN+1]	<=	data_2_3;
				end
				else begin
				for (i=0;i<`ID_25_LEN+1;i=i+1)		ID_25_reg[i] <= ID_25_reg[i+1];
				ID_25_reg[`ID_25_LEN+1]	<=	data_2_3;
				end
			end
			50'b00000000000000000000000100000000000000000000000000 : begin
				if (field_counter_2_3==0) begin
				for (i=0;i<`ID_26_LEN;i=i+1)		ID_26_reg[i] <= 0;
				ID_26_reg[`ID_26_LEN]	<=	data_2_3;
				end
				else begin
				for (i=0;i<`ID_26_LEN;i=i+1)		ID_26_reg[i] <= ID_26_reg[i+1];
				ID_26_reg[`ID_26_LEN]	<=	data_2_3;
				end
			end
			50'b00000000000000000000001000000000000000000000000000 : begin
				if (field_counter_2_3==0) begin
				for (i=0;i<`ID_27_LEN+1;i=i+1)		ID_27_reg[i] <= 0;
				ID_27_reg[`ID_27_LEN+1]	<=	data_2_3;
				end
				else begin
				for (i=0;i<`ID_27_LEN+1;i=i+1)		ID_27_reg[i] <= ID_27_reg[i+1];
				ID_27_reg[`ID_27_LEN+1]	<=	data_2_3;
				end
			end
			50'b00000000000000000000010000000000000000000000000000 : begin
				if (field_counter_2_3==0) begin
				for (i=0;i<`ID_28_LEN;i=i+1)		ID_28_reg[i] <= 0;
				ID_28_reg[`ID_28_LEN]	<=	data_2_3;
				end
				else begin
				for (i=0;i<`ID_28_LEN;i=i+1)		ID_28_reg[i] <= ID_28_reg[i+1];
				ID_28_reg[`ID_28_LEN]	<=	data_2_3;
				end
			end
			50'b00000000000000000000100000000000000000000000000000 :
				ID_29_reg[0]	<=	data_2_3;
			50'b00000000000000000001000000000000000000000000000000 :
				ID_30_reg[0]	<=	data_2_3;
			50'b00000000000000000010000000000000000000000000000000 :
				ID_31_reg[0]	<=	data_2_3;
			50'b00000000000000000100000000000000000000000000000000 :
				ID_32_reg[0]	<=	data_2_3;
			50'b00000000000000001000000000000000000000000000000000 : begin
				if (field_counter_2_3==0) begin
				for (i=0;i<`ID_33_LEN+1;i=i+1)		ID_33_reg[i] <= 0;
				ID_33_reg[`ID_33_LEN+1]	<=	data_2_3;
				end
				else begin
				for (i=0;i<`ID_33_LEN+1;i=i+1)		ID_33_reg[i] <= ID_33_reg[i+1];
				ID_33_reg[`ID_33_LEN+1]	<=	data_2_3;
				end
			end
			50'b00000000000000010000000000000000000000000000000000 : begin
				if (field_counter_2_3==0) begin
				for (i=0;i<`ID_34_LEN;i=i+1)		ID_34_reg[i] <= 0;
				ID_34_reg[`ID_34_LEN]	<=	data_2_3;
				end
				else begin
				for (i=0;i<`ID_34_LEN;i=i+1)		ID_34_reg[i] <= ID_34_reg[i+1];
				ID_34_reg[`ID_34_LEN]	<=	data_2_3;
				end
			end
			50'b00000000000000100000000000000000000000000000000000 :
				ID_35_reg[0]	<=	data_2_3;
			50'b00000000000001000000000000000000000000000000000000 :
				ID_36_reg[0]	<=	data_2_3;
			50'b00000000000010000000000000000000000000000000000000 : begin
				if (field_counter_2_3==0) begin
				for (i=0;i<`ID_37_LEN+1;i=i+1)		ID_37_reg[i] <= 0;
				ID_37_reg[`ID_37_LEN+1]	<=	data_2_3;
				end
				else begin
				for (i=0;i<`ID_37_LEN+1;i=i+1)		ID_37_reg[i] <= ID_37_reg[i+1];
				ID_37_reg[`ID_37_LEN+1]	<=	data_2_3;
				end
			end
			50'b00000000000100000000000000000000000000000000000000 : begin
				if (field_counter_2_3==0) begin
				for (i=0;i<`ID_38_LEN;i=i+1)		ID_38_reg[i] <= 0;
				ID_38_reg[`ID_38_LEN]	<=	data_2_3;
				end
				else begin
				for (i=0;i<`ID_38_LEN;i=i+1)		ID_38_reg[i] <= ID_38_reg[i+1];
				ID_38_reg[`ID_38_LEN]	<=	data_2_3;
				end
			end
			50'b00000000001000000000000000000000000000000000000000 : begin
				if (field_counter_2_3==0) begin
				ID_39_reg[0]	<=	0;
				ID_39_reg[1]	<=	0;
				ID_39_reg[2]	<=	data_2_3;
				end
				else begin
				ID_39_reg[0]	<=	ID_39_reg[1];
				ID_39_reg[1]	<=	ID_39_reg[2];
				ID_39_reg[2]	<=	data_2_3;
				end
			end
			50'b00000000010000000000000000000000000000000000000000 :
				ID_40_reg[0]	<=	data_2_3;
			50'b00000000100000000000000000000000000000000000000000 : begin
				if (field_counter_2_3==0) begin
				for (i=0;i<`ID_41_LEN - 1;i=i+1)		ID_41_reg[i] <= 0;
				ID_41_reg[`ID_41_LEN-1]	<=	data_2_3;
				end
				else begin
				for (i=0;i<`ID_41_LEN - 1;i=i+1)		ID_41_reg[i] <= ID_41_reg[i+1];
				ID_41_reg[`ID_41_LEN-1]	<=	data_2_3;
				end
			end
			50'b00000001000000000000000000000000000000000000000000 : begin
				if (field_counter_2_3==0) begin
				for (i=0;i<`ID_42_LEN - 1;i=i+1)		ID_42_reg[i] <= 0;
				ID_42_reg[`ID_42_LEN-1]	<=	data_2_3;
				end
				else begin
				for (i=0;i<`ID_42_LEN - 1;i=i+1)		ID_42_reg[i] <= ID_42_reg[i+1];
				ID_42_reg[`ID_42_LEN-1]	<=	data_2_3;
				end
			end
			50'b00000010000000000000000000000000000000000000000000 : begin
				if (field_counter_2_3==0) begin
				for (i=0;i<`ID_43_LEN - 1;i=i+1)		ID_43_reg[i] <= 0;
				ID_43_reg[`ID_43_LEN-1]	<=	data_2_3;
				end
				else begin
				for (i=0;i<`ID_43_LEN - 1;i=i+1)		ID_43_reg[i] <= ID_43_reg[i+1];
				ID_43_reg[`ID_43_LEN-1]	<=	data_2_3;
				end
			end
			50'b00000100000000000000000000000000000000000000000000 : begin
				if (field_counter_2_3==0) begin
				for (i=0;i<`ID_44_LEN - 1;i=i+1)		ID_44_reg[i] <= 0;
				ID_44_reg[`ID_44_LEN-1]	<=	data_2_3;
				end
				else begin
				for (i=0;i<`ID_44_LEN - 1;i=i+1)		ID_44_reg[i] <= ID_44_reg[i+1];
				ID_44_reg[`ID_44_LEN-1]	<=	data_2_3;
				end
			end
			50'b00001000000000000000000000000000000000000000000000 :
				ID_45_reg[0]	<=	data_2_3;
			50'b00010000000000000000000000000000000000000000000000 :
				ID_46_reg[0]	<=	data_2_3;
			50'b00100000000000000000000000000000000000000000000000 :
				ID_47_reg[0]	<=	data_2_3;
			50'b01000000000000000000000000000000000000000000000000 :
				ID_48_reg[0]	<=	data_2_3;
			50'b10000000000000000000000000000000000000000000000000 :
				ID_49_reg[0]	<=	data_2_3;
		endcase
		end
	end
end
			
assign ID_0=ID_0_reg[0];
assign ID_1=ID_1_reg[0];
assign ID_2=ID_2_reg[0];
assign ID_3=ID_3_reg[0];
assign ID_4={ID_4_reg[0][6:0],ID_4_reg[1][6:0],ID_4_reg[2][6:0],ID_4_reg[3][6:0],ID_4_reg[4][6:0],
					ID_4_reg[5][6:0],ID_4_reg[6][6:0],ID_4_reg[7][6:0],ID_4_reg[8][6:0],ID_4_reg[9][6:0],ID_4_reg[10][6:0]};
assign ID_5={ID_5_reg[0][6:0],ID_5_reg[1][6:0],ID_5_reg[2][6:0],ID_5_reg[3][6:0],ID_5_reg[4][6:0],
					ID_5_reg[5][6:0],ID_5_reg[6][6:0],ID_5_reg[7][6:0],ID_5_reg[8][6:0],ID_5_reg[9][6:0]};
assign ID_6={ID_6_reg[0],ID_6_reg[1],ID_6_reg[2],ID_6_reg[3],ID_6_reg[4]};
assign ID_7=ID_7_reg[0];
assign ID_8={ID_8_reg[0][1:0],ID_8_reg[1][6:0],ID_8_reg[2][6:0]};
assign ID_9={ID_9_reg[0][1:0],ID_9_reg[1][6:0],ID_9_reg[2][6:0]};
assign ID_10=ID_10_reg[0];
assign ID_11={ID_11_reg[0][5:0],ID_11_reg[1][6:0],ID_11_reg[2][6:0],ID_11_reg[3][6:0]
					,ID_11_reg[4][6:0],ID_11_reg[5][6:0],ID_11_reg[6][6:0]};
assign ID_12=ID_12_reg[0];
assign ID_13={ID_13_reg[0][5:0],ID_13_reg[1][6:0],ID_13_reg[2][6:0],ID_13_reg[3][6:0]
					,ID_13_reg[4][6:0],ID_13_reg[5][6:0],ID_13_reg[6][6:0]};
assign ID_14={ID_14_reg[0][6:0],ID_14_reg[1][6:0],ID_14_reg[2][6:0],ID_14_reg[3][6:0]
					,ID_14_reg[4][6:0],ID_14_reg[5][6:0],ID_14_reg[6][6:0],ID_14_reg[7][6:0]};
assign ID_15=ID_15_reg[0];
assign ID_16={ID_16_reg[0][0:0],ID_16_reg[1][6:0],ID_16_reg[2][6:0],ID_16_reg[3][6:0],ID_16_reg[4][6:0]
					,ID_16_reg[5][6:0],ID_16_reg[6][6:0],ID_16_reg[7][6:0],ID_16_reg[8][6:0],ID_16_reg[9][6:0]};
assign ID_17={ID_17_reg[0][0:0],ID_17_reg[1][6:0],ID_17_reg[2][6:0],ID_17_reg[3][6:0],ID_17_reg[4][6:0]
					,ID_17_reg[5][6:0],ID_17_reg[6][6:0],ID_17_reg[7][6:0],ID_17_reg[8][6:0],ID_17_reg[9][6:0]};
assign ID_18={ID_18_reg[0][0:0],ID_18_reg[1][6:0],ID_18_reg[2][6:0],ID_18_reg[3][6:0],ID_18_reg[4][6:0]
					,ID_18_reg[5][6:0],ID_18_reg[6][6:0],ID_18_reg[7][6:0],ID_18_reg[8][6:0],ID_18_reg[9][6:0]};
assign ID_19={ID_19_reg[0][0:0],ID_19_reg[1][6:0],ID_19_reg[2][6:0],ID_19_reg[3][6:0],ID_19_reg[4][6:0]
					,ID_19_reg[5][6:0],ID_19_reg[6][6:0],ID_19_reg[7][6:0],ID_19_reg[8][6:0],ID_19_reg[9][6:0]};
assign ID_20={ID_20_reg[0][0:0],ID_20_reg[1][6:0],ID_20_reg[2][6:0],ID_20_reg[3][6:0],ID_20_reg[4][6:0]
					,ID_20_reg[5][6:0],ID_20_reg[6][6:0],ID_20_reg[7][6:0],ID_20_reg[8][6:0],ID_20_reg[9][6:0]};
assign ID_21=ID_21_reg[0];
assign ID_22={ID_22_reg[0][0:0],ID_22_reg[1][6:0],ID_22_reg[2][6:0],ID_22_reg[3][6:0],ID_22_reg[4][6:0]
					,ID_22_reg[5][6:0],ID_22_reg[6][6:0],ID_22_reg[7][6:0],ID_22_reg[8][6:0],ID_22_reg[9][6:0]};
assign ID_23=ID_23_reg[0];
assign ID_24=ID_24_reg[0];
assign ID_25={ID_25_reg[0][0:0],ID_25_reg[1][6:0],ID_25_reg[2][6:0],ID_25_reg[3][6:0],ID_25_reg[4][6:0]
					,ID_25_reg[5][6:0],ID_25_reg[6][6:0],ID_25_reg[7][6:0],ID_25_reg[8][6:0],ID_25_reg[9][6:0]};
assign ID_26={ID_26_reg[0][4:0],ID_26_reg[1][6:0],ID_26_reg[2][6:0],ID_26_reg[3][6:0],ID_26_reg[4][6:0],ID_26_reg[5][6:0]};
assign ID_27={ID_27_reg[0][0:0],ID_27_reg[1][6:0],ID_27_reg[2][6:0],ID_27_reg[3][6:0],ID_27_reg[4][6:0]
					,ID_27_reg[5][6:0],ID_27_reg[6][6:0],ID_27_reg[7][6:0],ID_27_reg[8][6:0],ID_27_reg[9][6:0]};
assign ID_28={ID_28_reg[0][4:0],ID_28_reg[1][6:0],ID_28_reg[2][6:0],ID_28_reg[3][6:0],ID_28_reg[4][6:0],ID_28_reg[5][6:0]};
assign ID_29=ID_29_reg[0];
assign ID_30=ID_30_reg[0];
assign ID_31=ID_31_reg[0];
assign ID_32=ID_32_reg[0];
assign ID_33={ID_33_reg[0][0:0],ID_33_reg[1][6:0],ID_33_reg[2][6:0],ID_33_reg[3][6:0],ID_33_reg[4][6:0]
					,ID_33_reg[5][6:0],ID_33_reg[6][6:0],ID_33_reg[7][6:0],ID_33_reg[8][6:0],ID_33_reg[9][6:0]};
assign ID_34={ID_34_reg[0][4:0],ID_34_reg[1][6:0],ID_34_reg[2][6:0],ID_34_reg[3][6:0],ID_34_reg[4][6:0],ID_34_reg[5][6:0]};
assign ID_35=ID_35_reg[0];
assign ID_36=ID_36_reg[0];
assign ID_37={ID_37_reg[0][0:0],ID_37_reg[1][6:0],ID_37_reg[2][6:0],ID_37_reg[3][6:0],ID_37_reg[4][6:0]
					,ID_37_reg[5][6:0],ID_37_reg[6][6:0],ID_37_reg[7][6:0],ID_37_reg[8][6:0],ID_37_reg[9][6:0]};
assign ID_38={ID_38_reg[0][4:0],ID_38_reg[1][6:0],ID_38_reg[2][6:0],ID_38_reg[3][6:0],ID_38_reg[4][6:0],ID_38_reg[5][6:0]};
assign ID_39={ID_39_reg[0][1:0],ID_39_reg[1][6:0],ID_39_reg[2][6:0]};
assign ID_40=ID_40_reg[0];
assign ID_41={ID_41_reg[0],ID_41_reg[1],ID_41_reg[2]};
assign ID_42={ID_42_reg[0],ID_42_reg[1],ID_42_reg[2],ID_42_reg[3],ID_42_reg[4]
					,ID_42_reg[5],ID_42_reg[6],ID_42_reg[7]};
assign ID_43={ID_43_reg[0],ID_43_reg[1],ID_43_reg[2],ID_43_reg[3],ID_43_reg[4]
					,ID_43_reg[5],ID_43_reg[6],ID_43_reg[7]};
assign ID_44={ID_44_reg[0],ID_44_reg[1],ID_44_reg[2],ID_44_reg[3],ID_44_reg[4]
					,ID_44_reg[5],ID_44_reg[6],ID_44_reg[7]};					
assign ID_45=ID_45_reg[0];
assign ID_46=ID_46_reg[0];
assign ID_47=ID_47_reg[0];
assign ID_48=ID_48_reg[0];
assign ID_49=ID_49_reg[0];

		

endmodule
